package com.example.common.feign;

import com.example.common.entity.Order;
import com.example.common.result.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import java.math.BigDecimal;

@FeignClient(name = "order-service", fallback = OrderFeignClientFallback.class)
public interface OrderFeignClient {
    
    @GetMapping("/api/order/{id}")
    R getOrder(@PathVariable("id") Long id);
    
    @GetMapping("/api/order/no/{orderNo}")
    R getOrderByOrderNo(@PathVariable("orderNo") String orderNo);
    
    @PostMapping("/api/order/create")
    R<Order> createOrder(@RequestParam("userId") Long userId, @RequestParam("amount") BigDecimal amount);
}
